Other Changes
~~~~~~~~~~~~~
- ``dnp3`` has reduced the maximum number of open transactions from
- 500 down to 32, and the maximum number of points per message from
- unbounded to 16384. Configuration options, ``max-tx`` and
- ``max-points`` have been added for users who may need to change
- these defaults.
+ 500 down to 32, the maximum number of points per message from
+ unbounded to 16384, and the maximum number of objects per message
+ from unbounded to 2048. Configuration options, ``max-tx``,
+ ``max-points``, and ``max-objects`` have been added for users who
+ may need to change these defaults.
Upgrading to 7.0.9
------------------
alert dnp3 any any -> any any (msg:"SURICATA DNP3 Too many points in message"; \
app-layer-event:dnp3.too_many_points; \
classtype:protocol-command-decode; sid:2270005; rev:1;)
+
+# Too many objects.
+alert dnp3 any any -> any any (msg:"SURICATA DNP3 Too many objects"; \
+ app-layer-event:dnp3.too_many_objects; \
+ classtype:protocol-command-decode; sid:2270006; rev:1;)
/* The maximum number of points allowed per message (configurable). */
static uint64_t max_points = 16384;
+/* The maximum number of objects allowed per message (configurable). */
+static uint64_t dnp3_max_objects = 2048;
+
/* Decoder event map. */
SCEnumCharMap dnp3_decoder_event_table[] = {
{ "FLOODED", DNP3_DECODER_EVENT_FLOODED },
{ "MALFORMED", DNP3_DECODER_EVENT_MALFORMED },
{ "UNKNOWN_OBJECT", DNP3_DECODER_EVENT_UNKNOWN_OBJECT },
{ "TOO_MANY_POINTS", DNP3_DECODER_EVENT_TOO_MANY_POINTS },
+ { "TOO_MANY_OBJECTS", DNP3_DECODER_EVENT_TOO_MANY_OBJECTS },
{ NULL, -1 },
};
{
int retval = 0;
uint64_t point_count = 0;
+ uint64_t object_count = 0;
if (buf == NULL || len == 0) {
return 1;
DNP3ObjHeader *header = (DNP3ObjHeader *)buf;
offset += sizeof(DNP3ObjHeader);
+ /* Check if we've exceeded the maximum number of objects. */
+ if (++object_count > dnp3_max_objects) {
+ DNP3SetEventTx(tx, DNP3_DECODER_EVENT_TOO_MANY_OBJECTS);
+ goto done;
+ }
+
DNP3Object *object = DNP3ObjectAlloc();
if (unlikely(object == NULL)) {
goto done;
max_points = (uint64_t)value;
}
}
+
+ /* Parse max-objects configuration. */
+ if (ConfGetInt("app-layer.protocols.dnp3.max-objects", &value)) {
+ if (value > 0) {
+ dnp3_max_objects = (uint64_t)value;
+ }
+ }
} else {
SCLogConfig("Parser disabled for protocol %s. "
"Protocol detection still on.", proto_name);